// createWebHashHistory 是hash模式就是访问链接带有#
// createWebHistory  是history模式
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import routerList from './routerList'
// 引入文件，动态路由
const NotFound = () => import('../views/NotFound.vue')

const routes = [
  {
    path: '/',
    name: 'Home',
    component: () => import(/* webpackChunkName: "Home" */ '../views/Home.vue')
  },
  {
    path: '/About',
    name: 'About',
    component: () => import(/* webpackChunkName: "About" */ '../views/About.vue')
  },
  {
    path: '/:pathMatch(.*)*', // 代替vue2的通配符path: "*",
    name: 'NotFound',
    component: NotFound
  },
  {
    path: '/test', // 代替vue2的通配符path: "*",
    name: 'test',
    component: () => import(/* webpackChunkName: "Test" */ '../views/studentTest/test.vue')
  },
  ...routerList
]

const router = createRouter({
  history: createWebHashHistory(), // hash模式
  // history: createWebHistory(),  // history模式
  routes
})

export default router
